---
title: OpenTelemetry Protocol (OTLP) exporter
subtitle: Configure the OpenTelemetry Protocol (OTLP) exporter for metrics
description: Configure the OpenTelemetry Protocol (OTLP) exporter for metrics in the Apollo GraphOS Router or Apollo Router Core.
context:
  - telemetry
redirectFrom:
  - /graphos/routing/observability/telemetry/metrics-exporters/otlp
---
import BatchProcessorPreamble from '../../../../../../shared/batch-processor-preamble.mdx';
import BatchProcessorRef from '../../../../../../shared/batch-processor-ref.mdx';

Enable and configure the [OpenTelemetry Protocol (OTLP)](https://www.opentelemetry.io/) exporter for metrics in the GraphOS Router or Apollo Router Core.

For general metrics configuration, refer to [Router Metrics Configuration](/router/configuration/telemetry/exporters/metrics/overview).

Using the OTLP protocol, you can export metrics to any OTLP compatible receiver, including:

* [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/)
* [Datadog](https://www.datadoghq.com/) (see [configuration instructions](/router/configuration/telemetry/exporters/metrics/datadog))
* [Dynatrace](https://www.dynatrace.com/) (see [configuration instructions](/router/configuration/telemetry/exporters/metrics/dynatrace))
* [New Relic](https://www.newrelic.com/) (see [configuration instructions](/router/configuration/telemetry/exporters/metrics/new-relic))

## OTLP configuration

The router can be configured to export metrics data using OTLP over either HTTP or gRPC.

An example router configuration using OTLP with gRPC:

```yaml title="router.yaml"
telemetry:
  exporters:
    metrics:
      otlp:
        # Enable the OpenTelemetry exporter
        enabled: true
  
        # Optional endpoint, either 'default' or a URL (Defaults to http://127.0.0.1:4317 for gRPC and http://127.0.0.1:4318 for HTTP)
        endpoint: default
  
        # Optional protocol
        protocol: grpc
  
        # Optional gRPC configuration
        grpc:
          metadata:
            foo: bar
  
        # Optional batch_processor configuration
        batch_processor:
          scheduled_delay: 100ms
          max_concurrent_exports: 1000
          max_export_batch_size: 10000
          max_export_timeout: 100s
          max_queue_size: 10000
```

### `enabled`

Flag to enable the OTLP exporter.

Set to true to enable the OTLP exporter. Defaults to false.

### `endpoint`

The OTLP endpoint address.

Defaults to:
* http://127.0.0.1:4317 for gRPC
* http://127.0.0.1:4318 for HTTP

<Note>

If your environment sets `OTEL_EXPORTER_OTLP_ENDPOINT` or `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`, these variables take precedence over the `endpoint` configured in your `router.yaml`. If metrics aren't appearing at your expected endpoint, check if these environment variables are set and unset them if necessary.

</Note>

### `grpc`

Settings specific to the gRPC protocol for setting a custom SSL certificate, domain name, and metadata.

```yaml
telemetry:
  exporters:
    tracing:
      otlp:
        grpc:
          domain_name: "<my-domain>"
          key: "<key>"
          ca: "<certificate-authority>"
          cert: "<certificate>"
          metadata:
            key1: value1
            key2: value2    
```

<Tip>

Use the [variable expansion feature](/router/configuration/overview#variable-expansion) for referencing environment variables and file paths in YAML configuration files. Use `env.` and `file.` prefixes, for example `${file.ca.txt}`.

</Tip>

See [gRPC Authentication](https://grpc.io/docs/guides/auth/) for more information.

#### gRPC configuration reference

| Attribute     | Description                            |
|---------------|----------------------------------------|
| `domain_name` | An optional domain name                |
| `key`         | An optional key                        |
| `ca`          | An optional certificate authority      |
| `cert`        | An optional certificate                |
| `metadata`    | A map of headers to send with requests |


### `http`

Settings specific to the HTTP protocol for setting custom headers.

```yaml
http:
  headers:
    key1: value1
    key2: value2    
```

#### HTTP configuration reference

| Attribute | Description                            |
|-----------|----------------------------------------|
| `headers` | A map of headers to send with requests |


### `batch_processor`

<BatchProcessorPreamble />

An example configuration using OTLP with `batch_processor`:

```yaml
telemetry:
  exporters:
    metrics:
      otlp: 
        batch_processor: 
          max_export_batch_size: 512
          max_concurrent_exports: 1
          max_export_timeout: 30s 
          max_queue_size: 2048
          scheduled_delay: 5s
```

#### `batch_processor` configuration reference

<BatchProcessorRef />

## OTLP configuration reference

| Attribute       | Values                 | Default                                                               | Description                                                            |
|-----------------|------------------------|-----------------------------------------------------------------------|------------------------------------------------------------------------|
| `enabled`       |                        | `false`                                                               | Enable the OTLP exporter.                                              |
| `protocol`      | `grpc`\|`http`         | `grpc`                                                                | The protocol to use.                                              |
| `endpoint`      |                        | `http://127.0.0.1:4317` for gRPC and `http://127.0.0.1:4318` for HTTP | The endpoint to send spans to.                                         |
| `grpc`          |                        |                                                                       | Configuration specific to gRPC protocol.                               |
| `http`          |                        |                                                                       | Configuration specific to HTTP protocol.                               |
| `temporality`   | `delta`\|`cumulative`  |                                                                       | See the documentation for your APM to see what this should be set to.  |
